<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/util_file/common.jspf"%>
<script type="text/javascript" src="/jeons/js/jquery.popupWindow.js"></script>
<script type="text/javascript"
	src="/jeons/js/jquery.nyroModal.custom.js"></script>
<link rel="stylesheet" href="/jeons/css/nyroModal/nyroModal.css"
	type="text/css" media="screen" />
<script type="text/javascript"
	src="http://jqueryui.com/latest/ui/ui.core.js"></script>
<script type="text/javascript"
	src="http://jqueryui.com/latest/ui/ui.dialog.js"></script>
<style>
#table_title {
	font: 15px/1.2 "돋움", dotum, bold;
}

input text {
	width: 200px;
}

select option {
	width: 500px;
}

#product_title {
	font: 15px/1.2 "돋움", dotum, bold;
	background-color: gray;
	color: white;
}
</style>

<script type="text/javascript">
	$(document).ready( function(){
	/* 	$('#memoey').change( function(){
			alert($('#memoey option:selected').attr('var'));		//선택된 var 값 가져오기
		}); */
		
		$('select').change(function(){		//셀렉트 박스가 값이 변경될때마다 값이 적용됨
			var memoey_price = $('#memory option:selected').attr("price")*1;
			var cpu_price = $('#cpu option:selected').attr("price")*1;
			var mainboard_price = $('#mainboard option:selected').attr("price")*1;
			var graphic_price = $('#graphic option:selected').attr("price")*1;
			var soundnlan_price = $('#soundnlan option:selected').attr("price")*1;
			var hard_price = $('#hard option:selected').attr("price")*1;
			var cdndvd_price = $('#cdndvd option:selected').attr("price")*1;
			var power_price = $('#power option:selected').attr("price")*1;
			var case_price = $('#case option:selected').attr("price")*1;
			
			$("#money").val(memoey_price+cpu_price+mainboard_price+graphic_price+soundnlan_price+hard_price+cdndvd_price+power_price+case_price);
			
		
			/* var card_value = $('#card option:selected').attr('var')*1;
			$('#money').val(memoey_value+card_value); */
		});
		
		
		//배송비 선불시
		$('#prepaid').click(function(){
			var isChecked = $('#prepaid').attr("checked");
			if (isChecked) {
				$('#delivery').val('2500');
			}else{
				$('#delivery').val(' ');
			}
		});
		
		
		//메모리
		$('#memory').change(function(){
			var memoryno = $('#memory option:selected').attr('value')*1;
			alert("aaa");
			$("a#memory_info").attr('href','/jeons/admin/memory_info?memoryno='+memoryno); 
		});
		
		
		//씨피유
		$('#cpu').change(function(){
			var basicno = $('#cpu option:selected').attr('value')*1;
			$("a#cpu_info").attr('href','/jeons/admin/cpu_info?basicno='+basicno); 
		});
		
		//메인보드
		$('#mainboard').change(function(){
			var mainno = $('#mainboard option:selected').attr('value')*1;
			$("a#mainboard_info").attr('href','/jeons/admin/mainboard_info?mainno='+mainno);
		});
		
		//그래픽카드
		$('#graphic').change( function(){
			var graphicno = $('#graphic option:selected').attr('value')*1;
			$("a#graphic_info").attr('href','/jeons/admin/graphic_info?graphicno='+graphicno);
		});
		
		//사운드카드
		$('#soundnlan').change( function(){
			var snlno = $('#soundnlan option:selected').attr('value')*1;
			$("a#soundnlan_info").attr('href','/jeons/admin/soundnlan_info?snlno='+snlno);
		});
		
		//하드디스크
		$('#hard').change( function(){
			var hardno = $('#hard option:selected').attr('value')*1;
			$("a#hard_info").attr('href','/jeons/admin/hard_info?hardno='+hardno);
		});
		
		//cd n dvd
		$('#cdndvd').change( function(){
			var cdno = $('#cdndvd option:selected').attr('value')*1;
			$("a#cdndvd_info").attr('href','/jeons/admin/cdndvd_info?cdno='+cdno);
		});
		
		//파워
		$('#power').change( function(){
			var powerno = $('#power option:selected').attr('value')*1;
			$("a#power_info").attr('href','/jeons/admin/power_info?powerno='+powerno);
		});
		
		//케이스
		$('#case').change( function(){
			var caseno = $('#case option:selected').attr('value')*1;
			$("a#case_info").attr('href','/jeons/admin/case_info?caseno='+caseno);
		});
		
		
		//메모리 정보
		/* $('#btnMemory').click( function(){
			var memoey_value = $('#memory option:selected').attr('value')*1;
			$.ajax({
				type:'GET',
				url:'/jeons/admin/memory_info?memoryno='+memoey_value,
				success:function(data){
					data.popupWindow({ 
						height:500, 
						width:800, 
						top:50, 
						left:50 
						});
				
					
				alert(data);	
				},error:function(){
					alert("실패");
				}	
						
			}); 
		}); */
		
		
		$(".nm").nm({
			sizes:{
				minW : 400,
				maxW : 400,
				minH : 400,
				maxH : 400
			}
		});
		
		//팝업창
		$('.example1demo').popupWindow({ 
			height:350, 
			width:550, 
			top:50, 
			left:50 
			}); 
		
		
		
		$("a#memory_info").attr('href','/jeons/admin/memory_info?memoryno=3'); 
		
		
		
		//초기 값
		
		var memoey_price = $('#memory option:selected').attr("price")*1;
		var cpu_price = $('#cpu option:selected').attr("price")*1;
		var mainboard_price = $('#mainboard option:selected').attr("price")*1;
		var graphic_price = $('#graphic option:selected').attr("price")*1;
		var soundnlan_price = $('#soundnlan option:selected').attr("price")*1;
		var hard_price = $('#hard option:selected').attr("price")*1;
		var cdndvd_price = $('#cdndvd option:selected').attr("price")*1;
		var power_price = $('#power option:selected').attr("price")*1;
		var case_price = $('#case option:selected').attr("price")*1;
		
		$("#money").val(memoey_price+cpu_price+mainboard_price+graphic_price+soundnlan_price+hard_price+cdndvd_price+power_price+case_price);
		
		
		
	});
</script>
<br>
<div id="table_title">
	<table width="650" border="0" cellspacing=1 cellpadding=2
		bgcolor="#666666">
		<tr>
			<td rowspan="7" align=center width=300 bgcolor='#FFFFFF'>상품이미지</td>
			<td id="product_title">상품명</td>
			<td bgcolor='#FFFFFF'>삼성센스(상품명)</td>
		</tr>
		<tr>
			<td id="product_title">상품가격</td>
			<td bgcolor='#FFFFFF'>321,000</td>
		</tr>
		<tr>
			<td id="product_title">배송비</td>
			<td bgcolor='#FFFFFF'><input type="text" id="delivery"><input
				type="checkbox" id="prepaid" />선불</td>
		</tr>
		<tr>
			<td id="product_title">주문량</td>
			<td bgcolor='#FFFFFF'><input type="text" /></td>
		</tr>
		<tr>
			<td id="product_title">적립금</td>
			<td bgcolor='#FFFFFF'>200</td>
		</tr>
		<tr>
			<td id="product_title">반품</td>
			<td bgcolor='#FFFFFF'>불가능</td>
		</tr>
	</table>
	<br>
	<div align="right">
		<a href="#"><img src="/jeons/images/productimg/bt_buy.gif" /></a> <a
			href="#"><img src="/jeons/images/productimg/bt_basket.gif" /></a> <a
			href="#"><img src="/jeons/images/productimg/bt_wish.gif" /></a> <a
			href="#"><img src="/jeons/images/productimg/bt_cost.gif" /></a> <a
			href="#"><img src="/jeons/images/productimg/ripplego.gif" /></a>
	</div>
	<br>

	<div>
		<img src="/jeons/images/titledot.gif" />현재 물품 가격
	</div>
	<hr>
	<div>
		가격:<input type="text" id="money" />
	</div>
	<div>
		<img src="/jeons/images/titledot.gif" />상품 부품정보
	</div>
	<hr>
	<table>
		<tr>
			<td id="product_title">메모리</td>
			<td colspan="2">
				<%-- <select name="memory" id="memory">
				<c:forEach items="${memory}" var="item" varStatus="status">
					<option value="${item.memoryno}"price="${item.price}" p_number="${item.p_number}">${item.product}</option>
				</c:forEach>
			</select> <button type="button" id="btnMemory">정보</button> --%> <select
				name="memory" id="memory">
					<c:forEach items="${memory}" var="item" varStatus="status">
						<option value="${item.memoryno}" price="${item.price}"
							p_number="${item.p_number}">${item.product}</option>
					</c:forEach>
			</select> <a href="" class="example1demo" id="memory_info"><button
						type="button">정보</button></a>
			</td>
		</tr>
		<tr>
			<td id="product_title">CPU</td>
			<td colspan="2"><select name="cpu" id="cpu">
					<c:forEach items="${cpu}" var="item" varStatus="status">
						<option value="${item.basicno}" price="${item.price}"
							p_number="${item.p_number}">${item.product}</option>
					</c:forEach>
			</select><a href="" class="example1demo" id="cpu_info"><button
						type="button">정보</button></a></td>
		<tr>
			<td id="product_title">메인보드</td>
			<td colspan="2"><select name="mainboard" id="mainboard">
					<c:forEach items="${mainboard}" var="item" varStatus="status">
						<option value="${item.mainno}" price="${item.price}"
							p_number="${item.p_number}">${item.product}</option>
					</c:forEach>
			</select><a href="" class="example1demo" id="mainboard_info"><button
						type="button">정보</button></a></td>
		</tr>
		<tr>
			<td id="product_title">그래픽카드</td>
			<td colspan="2"><select name="graphic" id="graphic">
					<c:forEach items="${graphic}" var="item" varStatus="status">
						<option value="${item.graphicno}" price="${item.price}"
							p_number="${item.p_number}">${item.product}</option>
					</c:forEach>
			</select><a href="" class="example1demo" id="graphic_info"><button
						type="button">정보</button></a></td>
		<tr>
			<td id="product_title">사운드 & 랜</td>
			<td colspan="2"><select name="soundnlan" id="soundnlan">
					<c:forEach items="${soundnlan}" var="item" varStatus="status">
						<option value="">선택</option>
						<option value="${item.snlno}" price="${item.price}"
							p_number="${item.p_number}">${item.product}</option>
					</c:forEach>
			</select><a href="" class="example1demo" id="soundnlan_info"><button
						type="button">정보</button></a></td>
		</tr>
		<tr>
			<td id="product_title">하드디스크</td>
			<td colspan="2"><select name="hard" id="hard">
					<c:forEach items="${hard}" var="item" varStatus="status">
						<option value="${item.hardno}" price="${item.price}"
							p_number="${item.p_number}">${item.product}</option>
					</c:forEach>
			</select><a href="" class="example1demo" id="hard_info"><button
						type="button">정보</button></a></td>
		<tr>
			<td id="product_title">CD & DVD</td>
			<td colspan="2"><select name="cdndvd" id="cdndvd">
					<c:forEach items="${cdndvd}" var="item" varStatus="status">
						<option value="${item.cdno}" price="${item.price}"
							p_number="${item.p_number}">${item.product}</option>
					</c:forEach>
			</select><a href="" class="example1demo" id="cdndvd_info"><button
						type="button">정보</button></a></td>
		</tr>
		<tr>
			<td id="product_title">파워</td>
			<td colspan="2"><select name="power" id="power">
					<c:forEach items="${power}" var="item" varStatus="status">
						<option value="${item.powerno}" price="${item.price}"
							p_number="${item.p_number}">${item.product}</option>
					</c:forEach>
			</select><a href="" class="example1demo" id="power_info"><button
						type="button">정보</button></a></td>
		</tr>
		<tr>
			<td id="product_title">케이스</td>
			<td colspan="2"><select name="case" id="case">
					<c:forEach items="${case}" var="item" varStatus="status">
						<option value="${item.caseno}" price="${item.price}"
							p_number="${item.p_number}">${item.product}</option>
					</c:forEach>
			</select><a href="" class="example1demo" id="case_info"><button
						type="button">정보</button></a></td>
		</tr>
	</table>
	<br>
	<div>
		<img src="/jeons/images/titledot.gif" />상품 이미지
	</div>
	<hr>
	<br>
	<div>
		<img src="/jeons/images/titledot.gif" />추가 부품정보
	</div>
	<hr>
	<br>
	<div>
		<img src="/jeons/images/titledot.gif" />상품 후기
	</div>
	<hr>
	<br>
	<div>
		<img src="/jeons/images/titledot.gif" />상품 리뷰
	</div>
	<hr>

</div>
